﻿using Kylin.Wiki.IService;
using Kylin.Wiki.Model.Api;
using Kylin.Wiki.Model.Dto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Kylin.Wiki.Web.Controllers.System
{
    [Route("api/[controller]")]
    [ApiController]
    public class AuthController : BaseController
    {
        private readonly IUserService _userService;

        public AuthController(IUserService userService)
        {
            _userService = userService;
        }

        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="loginDto"></param>
        /// <returns></returns>
        [HttpPost,Route("Login")]
        [AllowAnonymous]
        public ApiResult<object> Login([FromBody]LoginDTO loginDto)
        {
            return _userService.Login(loginDto);
        }
    }
}
